package com.zhoutao.blog.seven.model;

import lombok.Data;

@Data
public class Response<T> {
    private Integer code;
    private String msg;
    private T data;

    public static <T> Response<T> success(T data) {
        return new Response<T>()
                .setCode(0)
                .setData(data);
    }

    public static <T> Response<T> fail(Integer code, String msg) {
        return new Response<T>()
                .setCode(code)
                .setMsg(msg);
    }
}
